{$header}
<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">新增入库单 [ <a href="__URL__/fastadd">批量导入</a> ]</h3>
<div id="result" class="result none"></div>
<form class="form-horizontal well" method='post' name="form1" id="form1" action="__URL__/insert/">
<table cellpadding=3 cellspacing=3 >
<notempty name="_REQUEST.buy_id">
<input type="hidden" name="buy_id" value="{$_REQUEST.buy_id}">
<tr> <td>采购单号</td><td>{$_REQUEST.buy_id|getModelName='Buy','buy_no'}</td> </tr>
</notempty>
<tr>
    <td width="150px">入库单号：</td>
	<td>
            <input  class="large" name="enter_no" value=""> <span class="alert alert-info">留空，则系统自动生成</span>
            送货单号<input  class="large" name="supplier_sale_no" value=""><br/> 
            <strong>入库时间</strong> ：<input type="text" class="span2" name="create_time" value="{:toDate(time())}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
            <strong>送货时间</strong> ：<input type="text" class="span2" name="arrive_time" value="{:toDate(time())}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
        </td>
</tr>
<!--
<tr>
    <td class="tRight" width="150px">按<b>条码</b>查询产品：</td>
	<td class="tLeft" >
            <input id="ptm" name="ptm_id" style="width:700px"></input>
            <br/><a class="btn btn-primary" href="javascript:void(0)" onclick="showdetail('ptm');">添加产品</a>
        </td>
</tr>
<tr>
	<td class="tRight" >按<b>拼音人工编码</b>查询产品：</td>
	<td class="tLeft" >
            <input id="ppy" name="ppy_id" style="width:700px"></input>
            <br/><a class="btn btn-primary" href="javascript:void(0)" onclick="showdetail('ppy');">添加产品</a>
        </td>
</tr> 
-->
<tr>
    <td class="tRight" >按<b>汉字</b>查询产品：</td>
    <td class="tLeft" >
            <div class="input-append">
                <input id="q" name="q" class="input-xxlarge search-query" placeholder="搜索"><input id="hz" name="hz_id" type="hidden"></input>
                <button class="btn" type="button" onclick="filter('enter')"><i class="icon-search"></i>搜索</button>
                <span class="help-inline alert">支持空格查询,如:名称 + 度数</span>
            </div>
        </td>
</tr>   

<tr>
	<td class="tRight">选择的产品：</td>
        <td class="tLeft">
            <table id="chosed_product" name="ptable" class="table table-bordered table-striped">
                <thead><tr><th width="85px">条码</th><th width="200px">名称</th><th>规格</th><th>采购数量</th><th>进价</th> <th>入库数量</th><th>单位</th><th>库存</th><th width="75px">生产批号</th><th width="75px">截止有效期</th><th>暂不录入</th><th>删除</th></tr></thead>
                <volist name="buy_details" id="buy_detail">
                    <tr>
                        <td>{$buy_detail.product_id|getModelName='Product','tm'} <input type="hidden" name="product_id[]" value="{$buy_detail.product_id}"> </td>
                        <td>{$buy_detail.product_id|getModelName='Product'} </td>
                        <td>{$buy_detail.product_id|printGoodsOption}</td>
                        <td>{$buy_detail.number}</td>
                        <td>{$buy_detail.enter_price}</td>
                            <td>
                            <input type="text" name="number[]" class="input-mini" value="{$buy_detail.number}"> 
                            <select name="finish[]" class="input-mini">
                                <option value="1">结束</option>
                                <option value="0">未完</option>
                            </select>
                         </td>
                        <td>{$buy_detail.product_id|getProductUnit} </td>
                        <td>-- 
                            <input type='hidden' name='enter_price[]' value='{$buy_detail.enter_price}'/>
                            <input type='hidden' name='buy_detail_id[]' value='{$buy_detail.id}'/>
                        </td>
                        <td><input type='text' class='input-small' name='lot[]' /></td>
                        <td><input type='text' class='input-small' name='exp[]' onClick='WdatePicker()' /></td>
                        <td class='span1'><img src='__APP__/Public/Images/publish_x.png' alt='暂不录入' onclick='removerow(this);'/></td>
                        <td><a href="__URL__/delete_buydetail/buydetail_id/{$buy_detail.id}" class="btn btn-primary input-mini">删除</a></td>

                    </tr>
                </volist>
            </table>
        </td>
</tr>
<tr>
	<td class="tRight" >供应商：</td>
	<td class="tLeft" >
        <notempty name="_REQUEST.buy_id">
            {$_REQUEST.buy_id|getModelName='Buy','supplier_id'|getModelName='Supplier'}
            <input type="hidden" name="supplier_id" value="{$_REQUEST.buy_id|getModelName='Buy','supplier_id'}">
            <else/>
            <select name="supplier_id" class="input-small">
                <volist name="suppliers" id="sp">
                <option value="{$key}">{$sp}</option>
                </volist>
            </select>
        </notempty>
        
            仓库：<select name="warehouse_id">
                <volist name="warehouses" id="ue">
                <option value="{$key}">{$ue}</option>
                </volist>
            </select>
            经办人：<select name="user_id" class="input-small">
                <volist name="users" id="us">
                <option value="{$key}" <eq name="_SESSION[C('USER_AUTH_KEY')]" value="$key">selected</eq> >{$us}</option>
                </volist>
            </select>
            
            
        </td>
</tr>
<tr>
	<td class="tRight">备注：</td>
        <td class="tLeft"><textarea class="span12" name="remark" rows="4"></textarea>
        </td>
</tr>
<tr>
	<td></td>
	<td class="center" width="300">
    <button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> 保存</button>
    <a class="btn btn-primary offset1" href="__URL__"><i class="icon-arrow-left icon-white"></i>返回</a>
	</td>
</tr>
</table>
</form>
</div>
</div>
<include file="Public:footer" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/easyui/themes/default/easyui.css">
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/filter-product.js"></script>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />

<script type="text/javascript"> 

document.onkeydown=function enterToTab() 
{ 
if(event.srcElement.type != 'submit' && event.srcElement.type!="image" && event.srcElement.type != 'textarea' 
&& event.keyCode == 13) 
event.keyCode = 9; 
} 
}

</script>
